package template;

import java.util.HashSet;
import java.util.Set;

public class Sets {
	public static <T> Set<T> union(Set<T> a,Set<T> b){
		Set<T> result = new HashSet<T>(a);
		result.addAll(b);
		return result;
	}

	public static <T> Set<T> intersetction(Set<T> a,Set<T> b){
		Set<T> result = new HashSet<T>();
		result.retainAll(b);
		return result;
	}
	public static <T> Set<T> difference(Set<T> superset,Set<T> subset){
		Set<T> result = new HashSet<T>(subset);
		result.remove(subset);
		return result;
	}
	public static <T> Set<T> complement(Set<T> a,Set<T> b){
		return difference(union(a,b),intersetction(a,b));
	}
}
